//
//  UINavigationController+Extension.swift
//  LiveTrivia
//
//  Created by 李响 on 2018/3/22.
//  Copyright © 2018年 LiveTrivia. All rights reserved.
//

import UIKit

extension UINavigationController {
    
    func first<T: UIViewController>(_ controller: T.Type) -> T? {
        return viewControllers.first { type(of: $0) == controller } as? T
    }
    
    func filter<T: UIViewController>(_ controller: T.Type) -> [T]? {
        return viewControllers.filter { type(of: $0) == controller } as? [T]
    }
}
